package arithmetic.LeetCode.Max_Consecutive_Ones;

/**
 * @author zhangyanqi
 * @since 1.0 2017/10/11
 */
public class Solution {

    public int findMaxConsecutiveOnes(int[] nums) {
        int result = 0, now = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] == 1) {
                now++;
                if (now > result) {
                    result = now;
                }
            } else {
                now = 0;
            }
        }
        return result;
    }
}
